﻿using System;

namespace BeeTest
{
    public class WhenState<T> : WhenStateBase
    {
        #region Fields & Properties
        
        private T               objectAfterWhenState;
        
        #endregion


        #region Constructors

        public WhenState(T objectAfterWhenState) : base(null)
        {
        }

        public WhenState(Exception exceptionDuringWhen) : base(exceptionDuringWhen)
        {
        }

        #endregion


        #region Operations

        #region Then Actions

        public void Then(Action<T> assertFunc)
        {
            this.AssertNoExceptionWasThrown();
            assertFunc(this.objectAfterWhenState);
        }

        public void Then<TP0>(Action<T, TP0> assertFunc, TP0 param0)
        {
            this.AssertNoExceptionWasThrown();
            assertFunc(this.objectAfterWhenState, param0);
        }

        public void Then<TP0, TP1>(Action<T, TP0, TP1> assertFunc, TP0 param0, TP1 param1)
        {
            this.AssertNoExceptionWasThrown();
            assertFunc(this.objectAfterWhenState, param0, param1);
        }

        public void Then<TP0, TP1, TP2>(Action<T, TP0, TP1, TP2> assertFunc, TP0 param0, TP1 param1, TP2 param2)
        {
            this.AssertNoExceptionWasThrown();
            assertFunc(this.objectAfterWhenState, param0, param1, param2);
        }

        public void Then<TP0, TP1, TP2, TP3>(Action<T, TP0, TP1, TP2, TP3> assertFunc, TP0 param0, TP1 param1, TP2 param2, TP3 param3)
        {
            this.AssertNoExceptionWasThrown();
            assertFunc(this.objectAfterWhenState, param0, param1, param2, param3);
        }

        public void Then<TP0, TP1, TP2, TP3, TP4, TP5>(Action<T, TP0, TP1, TP2, TP3, TP4, TP5> assertFunc, TP0 param0, TP1 param1, TP2 param2, TP3 param3, TP4 param4, TP5 param5)
        {
            this.AssertNoExceptionWasThrown();
            assertFunc(this.objectAfterWhenState, param0, param1, param2, param3, param4, param5);
        }

        #endregion


        #endregion

    }
}
